package com.wu.controller;/**
 * @author sun
 * @date 2022/3/21 - 7:20
 */

import com.wu.pojo.BoardcastRedirectcontent;
import com.wu.service.BoardcastRedirectcontentService;
import com.wu.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @description: TODO
 * @author 孙
 * @date 2022/3/21 7:20
 * @version 1.0
 */
@RestController
@Api(tags="BoardcastRedirectcontent模块")
@CrossOrigin
@RequestMapping("/boardcastredirect")
public class BoardcastRedirectcontentController {
    @Autowired
    private BoardcastRedirectcontentService boardcastRedirectcontentService;

    @PostMapping("/insertBoardcastRedirectcontent")
    @ApiOperation(value="增加BoardcastRedirectcontent")
    public R insertBoardcastRedirectcontent(@RequestBody BoardcastRedirectcontent boardcastRedirectcontent){
        try {
            boardcastRedirectcontentService.insertSelective(boardcastRedirectcontent);
            return R.ok();
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }

    }


    @GetMapping("/deleteBoardcastRedirectcontent/{id}")
    @ApiOperation(value="删除BoardcastRedirectcontent")
    public R deleteBoardcastRedirectcontent(Integer id){
        try {
            boardcastRedirectcontentService.deleteByPrimaryKey(id);
            return R.ok();
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }

    @PutMapping("/updateBoardcastRedirectcontent")
    @ApiOperation(value="更新BoardcastRedirectcontent")
    public R updateBoardcastRedirectcontent(@RequestBody BoardcastRedirectcontent boardcastRedirectcontent){
        try {
            boardcastRedirectcontentService.updateByPrimaryKeySelective(boardcastRedirectcontent);
            return R.ok();
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }

    @GetMapping("/findBoardcastRedirectcontent/{id}")
    @ApiOperation(value="通过id添加查询BoardcastRedirectcontent")
    public R findBoardcastRedirectcontent(Integer id){
        try {
            BoardcastRedirectcontent boardcastRedirectcontent= boardcastRedirectcontentService.selectByPrimaryKey(id);
            return R.ok().data("boardcastRedirectcontent",boardcastRedirectcontent);
        }catch (Exception e){
            e.printStackTrace();
            return R.error();
        }
    }
}
